package com.huayue.dao;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.huayue.entity.HousekeepOrderDetails;
import com.huayue.util.PageHelper;
import com.mysql.DBHelper;

/**
 * 房务订单详情
 */
@Component
public class HousekeepOrderDetailsDao implements BaseDao<HousekeepOrderDetails> {

    @Override
    public int insert(HousekeepOrderDetails entity) {
        return DBHelper.executeUpdate(
            "INSERT INTO housekeep_order_details (housekeep_order_id,room_id,housekeep_id,remark) VALUES ((select max(id) from housekeep_order),?,?,?)",
            entity.getRoom_id(), entity.getHousekeep_id(), entity.getRemark());
    }

    @Override
    public int update(HousekeepOrderDetails entity) {
        return 0;
    }

    @Override
    public int delete(HousekeepOrderDetails entity) {
        return 0;
    }

    @Override
    public List<Map<String, Object>> findAll(Object... obj) {
        return null;
    }

    @Override
    public List<Map<String, Object>> findPage(PageHelper page, Object... obj) {
        return null;
    }

    @Override
    public Map<String, Object> findOne(HousekeepOrderDetails entity) {
        return null;
    }

    @Override
    public int count(Object... obj) {
        return 0;
    }

    public List<Map<String, Object>> findDetails(String id) {
        return DBHelper.executeQuery(
            "SELECT room_id roomId,housekeep_id,remark FROM housekeep_order_details where is_deleted=0 and housekeep_order_id=?",
            id);
    }

}
